﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dqs_BLL;
using Dqs_DAL;
using Model;
using Sunny.UI;

namespace Dqs_UI
{
	public partial class frmTeacher : UIForm
	{
		public frmTeacher(TeacherInfo teacherInfo)
		{
			InitializeComponent();
			this._teacherInfo = teacherInfo;
		}

		TeacherInfo _teacherInfo { get; set; }
		Teacher_BLL teacher_BLL = new Teacher_BLL();
		Course_BLL course_BLL = new Course_BLL();



		private void uiButton1_Click(object sender, EventArgs e)
		{
			DialogResult = DialogResult.OK;
		}

		private void uiButton2_Click(object sender, EventArgs e)
		{
			if (Convert.ToInt32(cmbCourseName.SelectedValue) == -1)
			{
				MessageBox.Show("请先选择课程");
				return;
			}
			frmQuestion_Teacher student = new frmQuestion_Teacher();
			student.ShowDialog(this);
		}

		private void frmTeacher_Load(object sender, EventArgs e)
		{
			lblTeacherInfo.Text = "你好," + teacher_BLL.GetTeacherName(_teacherInfo.Id) + "老师";


			List<CourseInfo> list = course_BLL.GetCourses();
			list.Insert(0, new CourseInfo() { CourseName = "--请选择--", Id = -1 });
			//赋值
			cmbCourseName.DisplayMember = "CourseName";
			cmbCourseName.ValueMember = "Id";
			cmbCourseName.DataSource = list;


		}

		private void uiButton3_Click(object sender, EventArgs e)
		{
			frmTeacher_Student frmTeacher_Student = new frmTeacher_Student();
			frmTeacher_Student.ShowDialog(this);
		}
	}
}
